Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for libc variants without fseeko/ftello #4229

Merged
merged 4 commits into from
Jan 3, 2025
Merged

Conversation

Victor-C-Zhang
Copy link
Contributor

Some older Android libc implementations don't support fseeko or ftello. This commit adds a new compile-time macro LIBC_NO_FSEEKO as well as a usage in CMake for Android APIs 23 and below. Note this change is NOT intended to add support for zstd within old AOSP distributions. Google has long since stopped updating old branches. If you are an app developer working on API 23 or lower, this will allow you to package zstd in your app yourself.

Tested by adding the project in Android Studio and building the enclosing app on SDK versions 23 and 34 (current).
Used defaultConfig:

externalNativeBuild {
            cmake {
                cFlags += listOf("-DZSTD_BUILD_PROGRAMS", "-DZSTD_BUILD_STATIC")
                cppFlags += ""
                targets += listOf("zstd", "libzstd_static")
            }
        }

Some older Android libc implementations don't support `fseeko` or `ftello`.
This commit adds a new compile-time macro `LIBC_NO_FSEEKO` as well as a usage in CMake for old Android APIs.
#if defined(_MSC_VER) && _MSC_VER >= 1400
#if defined(LIBC_NO_FSEEKO)
/* Some older libc implementations don't include these functions (e.g. Bionic < 24) */
#define LONG_SEEK fseek
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit: indentation: not aligned with below #define

Copy link
Contributor

@Cyan4973 Cyan4973 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Globally fine,
just try to follow the same #define indentation as other #elif sections.

@Victor-C-Zhang Victor-C-Zhang merged commit 2759d9d into dev Jan 3, 2025
94 checks passed
@Victor-C-Zhang Victor-C-Zhang deleted the noFseek branch January 3, 2025 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants